package website.lucaswork.survey.api.exceptions;

import org.apache.commons.lang3.exception.ExceptionUtils;

public class ErrorInfo {

	public final static int GENERAL_ERROR = 100;
	public final static int UNKNOWN_PLACE = 101;
	
	private boolean isError;
	private int errorCode;
	private String errorDescription;
	public ErrorInfo(int errorCode, String errorDescription) {
		this.isError = true;
		this.errorCode = errorCode;
		this.errorDescription = errorDescription;
	}
	public ErrorInfo(int errorCode, Throwable throwable) {
		this.isError = true;
		this.errorCode = errorCode;
		this.errorDescription = ExceptionUtils.getRootCauseMessage(throwable);
	}
	public boolean isError() {
		return isError;
	}
	public void setError(boolean isError) {
		this.isError = isError;
	}
	public int getErrorCode() {
		return errorCode;
	}
	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}
	public String getErrorDescription() {
		return errorDescription;
	}
	public void setErrorDescription(String errorDescription) {
		this.errorDescription = errorDescription;
	}
}
